<?php
	require_once(realpath(dirname(__FILE__)) . "/../../classes/Variable.class.php");

	/* Substitutions de type variable */

	function substitvariable($texte){

	    preg_match_all("`\#VARIABLE\(([^\)]+)\)`", $texte, $cut);

	    $tab1 = "";
	    $tab2 = "";

	    for($i=0; $i<count($cut[1]); $i++){

	        $variable = new Variable();
	        $variable->charger($cut[1][$i]);
	        $tab1[$i] = "#VARIABLE(" . $cut[1][$i] . ")";
	        $tab2[$i] = $variable->valeur;
	    }

	    $texte = str_replace($tab1, $tab2, $texte);
	    return $texte;

	}

?>